<?php
namespace Content\Controller;
class QiniuController extends CommonController{
    
    /**
     * 获取token
     */
    public function uptoken(){
        Vendor('Qiniu.Config');
        Vendor('Qiniu.functions');
        vendor('Qiniu.Auth');
        $config = C('QINIU_CONFIG');
        $accessKey = $config['accessKey'];
        $secretKey = $config['secretKey'];
        $auth = new \Qiniu\Auth($accessKey, $secretKey);
    
		$bucket = $config['bucket'];
        $upToken = $auth->uploadToken($bucket);
        $data['uptoken'] = $upToken;
        echo '{"uptoken":"'.$upToken.'"}';
        die();
    }
}